home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / COMP.VIR < prev    next >
Internet Message Format  |  1990-05-20  |  8KB

  1. From cucard!rockyd!cmcl2!phri!sci.ccny.cuny.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!ucsd!rutgers!netnews.upenn.edu!vax1.cc.lehigh.edu!cert.sei.cmu.edu!krvw Fri Apr 20 16:55:42 1990
  2. Path: dasys1!cucard!rockyd!cmcl2!phri!sci.ccny.cuny.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!ucsd!rutgers!netnews.upenn.edu!vax1.cc.lehigh.edu!cert.sei.cmu.edu!krvw
  3. From: peter@ficc.uu.net (Peter da Silva)
  4. Newsgroups: comp.virus
  5. Subject: Usenet "virus" {Ed. HOAX - no, that's *not* a UNIX variant...}
  6. Message-ID: <0009.9004231214.AA04329@ubu.cert.sei.cmu.edu>
  7. Date: 20 Apr 90 20:55:42 GMT
  8. Sender: Virus Discussion List <VIRUS-L@IBM1.CC.Lehigh.EDU>
  9. Lines: 152
  10. Approved: krvw@sei.cmu.edu
  11.  
  12. > I have to believe that the same yahoos who think viruses are fun
  13. > things on single-user OS machines like PCs and Macs would love to
  14. > infect Unix and VMS systems, if they could.
  15.  
  16. They can.
  17.  
  18. > I really do believe that these systems are more difficult to
  19. > circumvent, and this has, to some extent, accounted for great disparity
  20. > in the number of successful attacks on these systems as compared to the
  21. > single-user boxes.
  22.  
  23. I believe you're right, *but* source code has little to do with it.
  24.  
  25. It's been at least 6 months since I posted this little fable.
  26.  
  27.             The Usenet virus: a case history.
  28.                 A cautionary tale.
  29.  
  30.         The Usenet virus was detected when a user discovered that
  31.     a  program  he  had  received  from  the  net  seemed to have two
  32.     versions of malloc included  with  the  source.  One  version  of
  33.     malloc  might  be odd, but people have never tired of reinventing
  34.     the wheel. Two versions were suspicious, particularly since  they
  35.     lead to a name conflict when the program was linked.
  36.  
  37.         The first, lmalloc.c,  seemed  to  be  identical  to  the
  38.     malloc  listed  in  Kernighan and Ritchie. The second, bmalloc.c,
  39.     was rather strange, so we concentrated our efforts on it...  this
  40.     time was later found to have been wasted.
  41.  
  42.         After a little work during spare moments over the  course
  43.     of  a  week  we  decided  it was actually a clumsy version of the
  44.     buddy system (a  fast  but  space-inefficient  method  of  memory
  45.     allocation).  It  might  make  a good example of how not to write
  46.     readable code in some textbook, but it  wasn't  anything  to  get
  47.     worried about.
  48.  
  49.         Back to the  first.  It  made  use  of  a  routine  named
  50.     speedhack()  that  was  called  before  sbrk() the first time the
  51.     malloc() was called. There was a file speedhack.c, but it  didn't
  52.     contain  any  code at all, just a comment saying that it would be
  53.     implemented in a future  version.  After  some  further  digging,
  54.     speedhack  was found at the end of main.c. The name was disguised
  55.     by some clever #defines, so  it  never  showed  up  in  tags  and
  56.     couldn't be found just by grepping the source.
  57.  
  58.         This program turned out to be a slow virus. When  it  was
  59.     run,  it  looked  for  a  file 'lmalloc.c'. If it found it, or it
  60.     didn't find Makefile,  it  returned.  From  then  on  malloc  ran
  61.     normally.
  62.  
  63.         If it didn't find it, it reconstructed it using a  series
  64.     of  other  routines  with innocuous names tagged on to the end of
  65.     other files. This was  apparently  an  attempt  to  avoid  overly
  66.     increasing the size of any one of the files in the directory.
  67.  
  68.         Then it went into Makefile or  makefile  (it  looked  for
  69.     both) and  added lmalloc.o onto the end of the first list of '.o'
  70.     files it found. It then reconstructed each of the extra routines,
  71.     and speedhack itself, using techniques familiar to any reader  of
  72.     the  obfuscated 'C' contest. These were tagged onto the  ends  of
  73.     the  '.c'  files that corresponded to the '.o' files in this same
  74.     list.  The program was now primed to reconstruct the virus.
  75.  
  76.         On inspection,  we  discovered  that  about  40%  of  the
  77.     sources   on  our system were infected by the speedhack virus, We
  78.     also found it in one set of shell  archives  that  we'd  received
  79.     but never unpacked or used, which we took as evidence that it had
  80.     spread to a number of other systems.
  81.  
  82.         We have no idea how our system was infected.   Given  the
  83.     frequency  with  which  we  make  modifications and updates, it's
  84.     likely that the original speedhacked code is  no  longer  on  the
  85.     system.   We  urge you to inspect your programs for this virus in
  86.     an attempt to track it to its source.  It   almost   slipped   by
  87.     us...  if  the  author  had  actually  put  a  dummy speedhack in
  88.     speedhack.c we would have  merely  taken  lmalloc.o  out  of  the
  89.     Makefile  and  defused *this* copy of the virus without being any
  90.     the wiser.
  91.  
  92.         There are other failings in this  program  that  we  have
  93.     thought  of. We have decided not to describe them to avoid giving
  94.     the author of this program ideas we might regret.  Some ways that
  95.     programs like this can be defeated include 'crc' checks of source
  96.     files  and,  of  course,  careful examination of sources received
  97.     from insecure sites.
  98.  
  99. - -----
  100.  
  101. Now I have to make a confession. This whole document is a hoax intended
  102. to dramatize the problems involved with viruses and Usenet. I suspect that
  103. most of you were clued to this by the Keywords line. While playing with the
  104. idea and writing this article several things occurred to me:
  105.  
  106. First of all, this virus is a much more complex program than any of the
  107. viruses that have been spotted on personal computers. I think it has to be,
  108. based on the design goals that a REAL UNIX virus must satisfy. I have not
  109. attempted to actually implement it because of this.
  110.  
  111.     It must be small, to avoid detection. It must not cause files to
  112. grow without bound.
  113.  
  114.     It must infect foreign files, otherwise it's not a virus... just a
  115. Trojan Horse (like the bogus ARC and FLAG programs on the PC). Trojan horses
  116. are a dime-a-dozen.
  117.  
  118.     It must infect source files, since this is the primary software
  119. distribution channel for UNIX. A virus stuck on one machine is a boring
  120. one.
  121.  
  122.     It must not break the infected program (other than what it might
  123. care to do deliberately).
  124.  
  125.     It must not be obvious from a simple examination of the source (like,
  126. changing main to Main and having a virus-main call Main).
  127.  
  128. I believe that given these goals (which are, of course, subject to
  129. debate) a simpler program would be successful in infesting more than a
  130. small fraction of the machines that (say) comp.sources.misc reaches.
  131.  
  132. There are systems immune to this particular attack, of course. Ones not
  133. running UNIX, so sbrk() doesn't work. Or ones with radically different
  134. versions of malloc(). Ones with no 'c' compiler. They are in the minority,
  135. though.
  136.  
  137. On the other hand a virus of this type could infest a large proportion
  138. of the net before it was found. The virus I described does not cause any
  139. direct damage, except for using up a relatively small amount of disk
  140. space. A more vicious virus is possible.
  141.  
  142. Other variations of this virus are obviously possible. For example, it
  143. could be tagged onto any standard 'C' library routine... I chose malloc
  144. merely because source was available and because it's something that people
  145. complain about, so they wouldn't be likely to find an extra copy suspicious.
  146. Another good routine would be perror(), for the same reason. This would have
  147. the additional benefit of making the spread of the infection dependent on
  148. an additional random factor, making it harder to detect the virus.
  149.  
  150. Do I think something like this is likely? No. Especially not now that
  151. I've written this little piece of science fiction. I'm sure that
  152. eventually someone will try something unlike this, I suspect that their
  153. virus would get caught much sooner than 'speedhack', because I think
  154. that more people look at the source than conventional wisdom would lead
  155. you to believe. But, again, this is just my personal opinion. Debate is
  156. welcomed... that's why I did this in the first place: to inject some
  157. sense into the debate currently raging in comp.sys.amiga.
  158.  
  159. - --
  160.  _--_|\  `-_-' Peter da Silva. +1 713 274 5180.      <peter@ficc.uu.net>
  161. /      \  'U`  Have you hugged your wolf today?  <peter@sugar.hackercorp.com>
  162. \_.--._/
  163.       v        Disclaimer: People have opini